import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx';
import AutoImport from 'unplugin-auto-import/vite'
import { VueUseComponentsResolver } from 'unplugin-vue-components/resolvers';
import components from 'unplugin-vue-components/vite';
import checkerPlugin from 'vite-plugin-checker';

// https://vitejs.dev/config/
export default defineConfig({
    server: {
        host: true,
        open: false,
    },
    plugins: [
        vue(),
        vueJsx(),
        AutoImport({
            dts: './types/auto-imports.d.ts',
            vueTemplate: true,
            imports: [
                "vue",
                {
                    from: 'vue',
                    imports: ['Ref', 'ComputedRef', 'PropType'],
                    type: true,
                },
            ],
        }),
        components({
            dts: './types/components.d.ts',
            resolvers: [VueUseComponentsResolver()],
            extensions: ['vue', 'tsx'],
            deep: true,
        }),
        checkerPlugin({
            eslint: {
                lintCommand: 'eslint \'./src/**/*.{ts,tsx,vue}\'',
                useFlatConfig: true,
            },
            enableBuild: false,
        }),
    ],
})
